#include "qprocessthread.h"

QProcessThread::QProcessThread(QObject *parent) :
    QObject(parent)
{

}


void QProcessThread::processSlot()
{
    bool endProcessFlag = false;
    int returnImageWidth;
    int returnImageHeight;
    int returnImageStep;
    unsigned char* data=NULL;
    while (!endProcessFlag)
    {
        data = processVideo(&returnImageWidth, &returnImageHeight, &returnImageStep, &endProcessFlag);
        if (!endProcessFlag)
        {
            QImage tempImage(data,returnImageWidth,returnImageHeight,returnImageStep,QImage::Format_RGB888);
            emit sendImage(tempImage);
        }
    }
    emit videoEnd();
}

void QProcessThread::processImageFile()
{
    int returnImageWidth;
    int returnImageHeight;
    int returnImageStep;
    unsigned char* data=NULL;
    data = processFrame(&returnImageWidth, &returnImageHeight, &returnImageStep);

    QImage tempImage(data,returnImageWidth,returnImageHeight,returnImageStep,QImage::Format_RGB888);
    emit sendImage(tempImage);
    emit videoEnd();
}
